Contents | Index | < Browse | Browse >
LETTERabsULETTER
Returns the absolute value of an integer.
Overview
#include <stdlib.h>
r = abs(i);
int r; // result
int i; // integer
Portability
ANSI
Description
"abs" returns the absolute value of the argument passed it and operates
similar to "(i >=0 ? +i : -1)". The function can also be used as a macro:
#define abs(x) ((x)<0?-(x):(x))
Returns
The absolute value of its argument.
See also
fabs , labs